package atm;

import javax.swing.*;
import java.awt.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;

/**
 * 查询界面
 */
public class SearchPanel extends JPanel implements ActionListener {
    private ATMFrame atmFrame;
    private JLabel blanceLabel = new JLabel();
    private JButton backBtn = new JButton(new ImageIcon("images/buttonSure.jpg"));
    private Font font = new Font("黑体",Font.BOLD,30);
    public SearchPanel(ATMFrame atmFrame){
        this.atmFrame = atmFrame;
        this.setLayout(null);
        blanceLabel.setBounds(300,200,300,50);
        blanceLabel.setFont(font);

        backBtn.setBounds(350,400,140,50);
        backBtn.addActionListener(this);

        this.add(blanceLabel);
        this.add(backBtn);
        this.setOpaque(false);
    }

    public void showBlance(){
        blanceLabel.setText("你的余额为：" + atmFrame.getLoginUser().getBlance());
    }

    @Override
    public void actionPerformed(ActionEvent e) {
        if (e.getSource() == backBtn) {
            atmFrame.switchPanel("menu");
        }
    }
}
